import Vue from 'vue'
import VueRouter from 'vue-router'
import Layout from '@/views/layout.vue'
import Home from '@/views/home.vue'
import FindHouse from '@/views/find-house.vue'
import News from '@/views/news.vue'
import User from '@/views/user.vue'
import CityList from '@/views/city-list.vue'
import Details from '@/views/details.vue'
const Map = () => import('@/views/map.vue')
const Login = () => import('@/views/login.vue')
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      { path: 'home', component: Home },
      { path: 'findhouse', component: FindHouse },
      { path: 'news', component: News },
      { path: 'user', component: User }
    ]
  },
  { path: '/citylist/:id', component: CityList },
  { path: '/details/:id', component: Details },
  { path: '/map', component: Map },
  { path: '/login', component: Login }
]

const router = new VueRouter({
  routes
})

export default router
